package cn.iocoder.yudao.module.shop.dal.mysql.itemcount;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.shop.dal.dataobject.itemcount.ShopItemCountDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.shop.controller.admin.itemcount.vo.*;

/**
 * 项目计数 Mapper
 *
 * @author 曹建伟
 */
@Mapper
public interface ShopItemCountMapper extends BaseMapperX<ShopItemCountDO> {

    default PageResult<ShopItemCountDO> selectPage(ShopItemCountPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<ShopItemCountDO>()
                .eqIfPresent(ShopItemCountDO::getUserId, reqVO.getUserId())
                .eqIfPresent(ShopItemCountDO::getNum, reqVO.getNum())
                .betweenIfPresent(ShopItemCountDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(ShopItemCountDO::getId));
    }

    default List<ShopItemCountDO> selectList(ShopItemCountExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<ShopItemCountDO>()
                .eqIfPresent(ShopItemCountDO::getUserId, reqVO.getUserId())
                .eqIfPresent(ShopItemCountDO::getNum, reqVO.getNum())
                .betweenIfPresent(ShopItemCountDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(ShopItemCountDO::getId));
    }

}
